<html>
<title>runDE</title>
<body style="padding:20px;width:650px;font-family:Times;">
<h1>Differential expression (DE)</h1>

This tool allows you to define groups of libraries and compare their expression levels
for differential expression, using one of several R packages (EdgeR, DESeq, DEGeq). 
DE-enriched GO categories can also be found using GOSeq. Packages EDAseq (normalization)
and multtest (FDR correction) can also optionally be used. (See the Online Guide
for assistance installing the R packages; note that you only need to install those you 
intend to use.)

<ol>
<li>Select libraries - at least one library for each group
<li>Select method - from the 3 available methods
<li>Normalization - EDASeq or default
<li>Use fixed dispersion - for EdgeR/DESeq
<li>False discovery rate - applied to any method 
<li>Pval Column - name of column for the results in the database
<li>Execute - execute on selected libraries (single execution).
<ol>
<li>All Pairs for Group 1 - execute on all libraries in Group 1 against all libraries.
<li>Get Pairs from File - execute on all pairs from file.
</ol>
<li>GOseq - add DE grouped by GO
<li>Remove - remove DE and GOseq columns from database
</ol>

<a name=lib>
<h3>Select libraries</h3>

Ordinarily you should pick exactly one library for each group, creating a two-library comparison.
In this case, any replicates in the libraries will automatically be used by those methods (EdgeR,DESeq) 
which employ replicates.
<p>
You can also form groups having more than one library, in which case the libraries in a given
group will be treated as replicates. This is not recommended unless the libraries are
expected to be quite similar; instead, you can run the desired pairwise comparisons, and then
use the filtering functions in viewSingleTCW to construct filters involving DE among
multiple libraries.
<p>
If you need to compute DE for many pairs, it is better to use options 7.1 or 7.2.
Moreover, if you are creating multiple singleTCW databases for comparison with multiTCW,
entering the information from file allows you to use the same file for each sTCW (and ensures
consistent naming of columns).

<a name=method>
<h3>Select method</h3>

Choose the R package you wish to apply (descriptions of the packages are on Bioconductor). 
<p>
When the methods are run, the R commands will print to the screen, allowing you to see exactly
what was done. The R session remains open afterwards, allowing you to further explore the data
if desired. 
<ul>
<li>EdgeR, DESeq: These packages both use a negative-binomial model and use replicates (if available)
to calculate dispersion. If you have no replicates, you should estimate a 
<a href="#disp">fixed dispersion</a>. 
<li>
DEGseq: This package supports several methods, of which three are implemented. FET is 
the traditional Fisher Exact Test; for the others, see the DEGseq manual. 
</ul>

<a name=norm>
<h3>Normalization</h3>

The EDAseq R package can be used, if desired, to normalize the count data prior to DE computation.
EDAseq provides GC-bias normalization, along with more standard quantile-based normalization.
If "EDAseq" is chosen, then the default normalization methods contained in the DE packages are not run.
<p>
If "Default" is chosen, then the normalization methods included in EdgeR and DESeq packages are run.
No normalization is run for DEGseq methods. 

<a name=method>
<h3>Use fixed dispersion</h3>

EdgeR and DESeq are designed to estimate the dispersion parameter 
using replicates, if available. If replicates
are not available then you can choose a fixed dispersion value suitable for the libraries
being compared. The default 0.1 reflects a moderate level of biological variation.

<a name=fdr>
<h3>False Discovery Rate</h3>

This option uses the "multtest" R package to convert the DE p-values to Benjamini-Hochberg False 
Discovery Rate values.  

<a name=column>
<h3>Pval column</h3>
To add results to database:
<ul>
<li>To save the results in the database, check the box next to "Save results in Pval column". 
<li>If the column already exists, it will prompt you as to whether you want to overwrite the existing results.
<ul>
<li>
If you check the box after selecting the libraries, it will enter a possible column name, which you can change.
<li>
If the libraries selection has changed, to update the column select, uncheck the box and check it again.
</ul>
<li>The library name must be letter, digit or the underscore. Keep the library name short but meaningful, as its used as a column heading in the singleTCW table of results.
</ul>
<i>Note: this is NOT checked by default, so remember to check it if you want the
data to go into the database</i>. 
<p>You can add multiple columns to compare the results of different methods, then
remove the columns you do not want by selecting the columns with the
"Select Pval Column" followed by the "Remove" button. 
<a name=exec>
<h3>Execute</h3>
At the end of execution, the terminal will be in the "R environment" so that you can execute
R commands to view graphs of the results. You must enter "quit()" to exist R; it will ask
you if you want to "save the workspace image"; if you are not familar with R, ignore this.

<h4>All Pairs for Group 1</h4>
Each library selected in group 1 will be compared with all other libraries, and save in the 
database with a generated column name. For example, if you have libraries X, Y and Z and
you select X and Y, it will compute DE for XY, XZ and YZ.
<h4>Get Pairs from File</h4>
The file can have many rows, where each line contains three columns separated by blanks.
The first column is group1, the second is group2, and the third is the column name. If
you want multiple libraries for group1, separate them with colons. For example:
<pre>
root stem RoSt
root rhiz RoRz
root:rhiz stem RRxStS
</pre>
This will run the selected method on these three sets and create columns RoST, RoRz, RRxST.
The third entry uses two libraries for the first group.
<p>It will overwrite any existing columns with the same name.
<a name=GOseq>
<h3>GOseq</h3>
Select Pval Column: 
<ul>
<li>Select with left mouse to see all choices.
<li>Select with right mouse to click through choices.
<li>The "Select All Column" apply to all columns.
</ul>
Then press "Execute GOseq" to run this function on all selected columns.
 The data will be entered into the GO table of the database using the Pval column name.
 If the Pval column exists, it will overwrite the existing value.
<h3>Remove</h3>
Select the column (or columns) as describe in the previous section (Select Pval Column).
Press "Remove" to remove the DE column and corresponding GOseq column (if it exists).

</html>